package com.foreknow.dao;
import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public interface BaseDao<T> {
    /**
     * 删除
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public int delete(String sql,Object...params) throws SQLException;

    /**
     * 删除
     * @param sql
     * @return
     * @throws SQLException
     */

    public int delete(String sql) throws SQLException;

    /**
     * 添加
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */

    public int insert(String sql,Object [] params) throws SQLException;

    /**
     * 查询
     * @param sql
     * @return
     * @throws SQLException
     */
    public List<T> queryByCondition(String sql) throws SQLException;

    /**
     * 查询
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public List<T> queryByCondition(String sql,Object...params) throws SQLException;

    /**
     * 查询一个对象
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public T queryOne(String sql,Object params) throws SQLException;
    public T queryOne(String sql,Object[] params)throws SQLException;
    /**
     * 修改
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public int update(String sql,Object...params)throws SQLException;

    /**
     * 修改
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public int update(String sql,Object params) throws  SQLException;

    /**
     *
     */
    public ResultSetHandler<T> getResultSetHandler();
}
